;;配置package 源 melpa.org 
(when (>= emacs-major-version 24)
  (require 'package)
  (package-initialize)
  (setq package-archives '(("gnu"   . "http://elpa.emacs-china.org/gnu/")
			   ("melpa" . "http://elpa.emacs-china.org/melpa/"))))

(require 'cl)
(defvar gensir/packages '(
			  ;;优化操作
			  popwin;;弹出窗口管理器
			  ergoemacs-mode
			  ;;mwe-log-commands
			  ;;自动补全
			  company
			  ;;优化编辑方式
			  hungry-delete;;删除选中的
			  smartparens;;智能括号
			  
			  ;;swiper
			  ;;counsel
			  ;;helm-ag;;全局搜索工具
			  			  
			  ;;emmet-mode
			  ;;web-mode
			  ;;js2-refactor
			  ;;expand-region
			  ;;iedit
			  ;;org-pomodoro
			  ;;flycheck
			  ;;auto-yasnippet
			  ;;js-mode
			  ;;js2-mode
			  ;;nodejs-mode
			  ;;nodejs-repl
			  
			  ;;主题
			  monokai-theme) "Default packages")
(setq package-selected-packages gensir/packages)
(defun gensir/packages-installed-p ()
  (loop for pkg in gensir/packages
	when (not (package-installed-p pkg)) do (return nil)
	finally (return t)))
(unless (gensir/packages-installed-p)
  (message "%s" "Refreshing package database...")
  (package-refresh-contents)
  (dolist (pkg gensir/packages)
    (when (not (package-installed-p pkg))
      (package-install pkg))))


(provide 'init-packages)



